﻿using System;
using System.Collections.Generic;
using Skynet.CommonLibrary.ThreadRefreshTime.StrateGy;

namespace Skynet.CommonLibrary.ThreadRefreshTime.Interface
{
    /// <summary>
    /// 刷新任务管理
    /// </summary>
    ///<remarks>
    /// 作者：         李志强
    /// 开发时间：  2011-03-28
    /// </remarks>
    public interface IRefreshTimerManage
    {
        /// <summary>
        /// 时间刷新列表
        /// </summary>
        IList<IRefreshTimer> TimerList { get; }
        
        /// <summary>
        /// 定时刷新间隔（如果IRefreshTimer中的RefreshInterval为0时，则以此属性为准）
        /// </summary>
        int RefreshInterval { set; }

        /// <summary>
        /// 动态添加 需要定时刷新的元素
        /// </summary>
        /// <param name="refTime"></param>
        /// <param name="serategy"> </param>
        void AddRefreshTimer(IRefreshTimer refTime,IThreadStrategy serategy);

        /// <summary>
        /// 删除一个 定时刷新元素
        /// </summary>
        /// <param name="refTime"></param>
        void RemoveRefreshTimer(IRefreshTimer refTime);

        /// <summary>
        /// 删除全部
        /// </summary>
        void RemoveAll();

        /// <summary>
        /// 当某个元素抛出异常时，触发
        /// </summary>
        Action<IRefreshTimer,Exception> RefreshFailed { set; }
    }
}
